{% extends 'user/user_base.html' %}
{% block title %}
    用户订单
{% endblock %}
{% block right_content%}
    <div class="right_content clearfix">
    <h3 class="common_title2">全部订单</h3>
    {% for orderinfo in orderlist %}
    <ul class="order_list_th w978 clearfix">
        <li class="col01">{{orderinfo.odate}}</li>
        <li class="col02">订单号：{{orderinfo.oid}}</li>
        {% if orderinfo.zhifu == 1 %}
        <li class="col02 stress">已支付</li>
        {% else %}
        <li class="col02 stress">未支付</li>
        {% endif %}
    </ul>
    <table class="order_list_table w980">
        <tbody>
        <tr>
            <td width="55%">
                {% for item in orderinfo.orderdetailinfo_set.all %}
                <ul class="order_goods_list clearfix">
                    <li class="col01"><img src="/static/{{item.goods.gpic}}"></li>
                    <li class="col02">{{item.goods.gtitle}}<em><span>{{item.price}}</span>元/{{item.goods.gunit}}</em>
                    </li>
                    <li class="col03">{{item.count}}个</li>
                    <li class="col04"></li>
                </ul>
                {% endfor %}
            </td>
            <td width="15%">{{orderinfo.ototal}}元</td>
            {% if orderinfo.zhifu == 1 %}
            <td width="15%">已付款</td>
            <td width="15%"><a href="#" class="oper_btn">查看物流</a></td>
            {% else %}
            <td width="15%">未付款</td>
            <td width="15%"><a href="/order/pay&{{orderinfo.oid}}/" class="oper_btn">去付款</a></td>
            {% endif %}
        </tr>
        </tbody>
    </table>
    {% endfor %}
    <div class="pagenation">
        {% if orderlist.has_previous %}
        <a href="/user/user_center_order&{{orderlist.previous_page_number}}/">
            上一页
        </a>
        {% endif %}
{#    分页 ： plist 一共多少页  pageid 当前页  orderlist paginator按照两个一页，分的，页的指向对象  #}
    {% if lenn < 4  %}
        {% if lenn == 1 %}
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
        {% elif lenn == 2 %}
            {% if pageid == 1 %}
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
            <a href="/user/user_center_order&{{next}}/" >{{next}}</a>
            {% else %}
            <a href="/user/user_center_order&{{pre}}/" >{{pre}}</a>
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
            {% endif %}
        {% elif lenn == 3%}

            {% if pageid == 1 %}
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
            <a href="/user/user_center_order&{{next}}/" >{{next}}</a>
            <a href="/user/user_center_order&{{nextt}}/" >{{nextt}}</a>
            {% elif pageid == 2 %}
            <a href="/user/user_center_order&{{pre}}/" >{{pre}}</a>
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
            <a href="/user/user_center_order&{{next}}/" >{{next}}</a>
            {% else %}
            <a href="/user/user_center_order&{{pree}}/" >{{pree}}</a>
            <a href="/user/user_center_order&{{pre}}/" >{{pre}}</a>
            <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
            {% endif %}
        {% endif %}
    {% elif pageid < lenn %}
        {% if orderlist.has_previous  %}
        <a href="/user/user_center_order&{{pre}}/" >{{pre}}</a>
        <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
        <a href="/user/user_center_order&{{next}}/" >{{next}}</a>
        {% else %}
        <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
        <a href="/user/user_center_order&{{next}}/" >{{next}}</a>
        <a href="/user/user_center_order&{{nextt}}/" >{{nextt}}</a>
        {% endif %}
    {% else %}
        <a href="/user/user_center_order&{{pree}}/" >{{pree}}</a>
        <a href="/user/user_center_order&{{pre}}/" >{{pre}}</a>
        <a href="/user/user_center_order&{{pageid}}/" class="active">{{pageid}}</a>
    {% endif %}


        {% if orderlist.has_next %}
        <a href="/user/user_center_order&{{orderlist.next_page_number}}/">下一页></a>
        {% endif %}
    </div>
</div>


{% endblock %}